class CreateRestaurants < ActiveRecord::Migration[5.2]
  def change
    create_table :restaurants do |t|
      t.string  :uid,       null: false,  limit: 64
      t.string  :name,      null: false,  limit: 64
      t.string  :province,  null: false,  limit: 16
      t.string  :city,      null: false,  limit: 16
      t.string  :district,  null: false,  limit: 16
      t.string  :address,   null: false,  limit: 64
      t.decimal :longitude, null: false,  precision: 10, scale: 6
      t.decimal :latitude,  null: false,  precision: 10, scale: 6
      t.string  :status,    null: false,  limit: 16
      t.integer :max_spec,  null: false,  default: 0
      t.timestamps          null: false
    end

    add_index :restaurants, :province
    add_index :restaurants, :city
    add_index :restaurants, :district
  end
end
